package com.ztgf.commodity.service;

import com.ztgf.commodity.models.vo.CommodityParamValueRelationVO;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.BeanUtils;

import javax.annotation.Resource;

import com.ztgf.commodity.common.config.YmlConfig;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.ztgf.commodity.mapper.CommodityParamValueRelationMapper;
import com.ztgf.commodity.models.service.ICommodityParamValueRelationService;
import com.ztgf.commodity.models.bo.CommodityParamValueRelationSaveBO;
import com.ztgf.commodity.models.dto.CommodityParamValueRelationDTO;

import java.util.List;

/**
 * 商品参数信息关系表控制器
 *
 * @author chenyu.wang
 * @Date 2020-06-15 14:59:24
 */
@DubboService
public class CommodityParamValueRelationServiceImpl extends ServiceImpl<CommodityParamValueRelationMapper, CommodityParamValueRelationDTO> implements ICommodityParamValueRelationService {

    @Resource
    private YmlConfig ymlConfig;

    @Override
    public boolean add(CommodityParamValueRelationSaveBO saveBO) {
        CommodityParamValueRelationDTO dto = new CommodityParamValueRelationDTO();
        BeanUtils.copyProperties(saveBO, dto);
        Long id = ymlConfig.getPkId();
        dto.setId(id);
        return this.insert(dto);
    }

    @Override
    public List<CommodityParamValueRelationVO> queryGoodsParamDetails(Long goodsId) {
        return baseMapper.queryGoodsParamDetails(goodsId);
    }
}
